//
//  TaoCanDetailViewController.m
//  XDBaseFrameWork
//
//  Created by XD-XY on 9/20/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#import "TaoCanDetailViewController.h"
#import "UIImageView+WebCache.h"
#import "StarCell.h"
#import "DLStarRatingControl.h"

#import "MJPhoto.h"
#import "MJPhotoBrowser.h"
#import "UIImageView+MJWebCache.h"

#import "AppointmentPhotographerViewController.h"
#import "APPointmentHospitalViewController.h"
#import "OrderConfirmViewController.h"

#import "CommentListViewController.h"

#import "TaoCanCell.h"

@interface TaoCanDetailViewController ()
{
    NSString * ModeCount;
    NSString * ShootCount;
    NSString * RepairCount;
    NSString * PhotoCount;
}
@end

@implementation TaoCanDetailViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    CGRect rect = self.titleLabel.frame;
    rect.origin.x = 40;
    rect.size.width = UI_SCREEN_WIDTH-80;
    self.titleLabel.frame = rect;
    self.titleLabel.text = self.SeriesName;
    
    ReviewAvg = [[NSString alloc] init];
    ReviewCount = [[NSString alloc] init];
    hospitalArray = [[NSMutableArray alloc] init];
    pmid= [[NSString alloc] init];
    imageUrlArray = [[NSMutableArray alloc] init];
    
    ModeCount = [[NSString alloc] init];
    ShootCount = [[NSString alloc] init];
    RepairCount = [[NSString alloc] init];
    PhotoCount = [[NSString alloc] init];

    
    [self initViews];

    [self getTaoCanDetailDatas];
}

#pragma mark
#pragma mark UI 布局
-(void)initViews
{
    mTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, self.contentView.frame.size.height-49)];
    mTableView.backgroundColor = [UIColor clearColor];
    mTableView.delegate =self;
    mTableView.dataSource = self;
    mTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.contentView addSubview:mTableView];

    [self initHeadViews];
    [self initRootViews];

    footview = [UIView initViewRect:CGRectMake(0,self.view.frame.size.height-49, UI_SCREEN_WIDTH, 49) andBackGroudColor:self.contentView.backgroundColor];
    [self.view addSubview:footview];

    UIView * line = [UIView initViewRect:CGRectMake(0, 0,UI_SCREEN_WIDTH, 0.5) andBackGroudColor:UIColorFromRGB(0xdcdcdc)];
    [footview addSubview:line];
    
    NSString * str;
    if (self.type==1){
        str = @"选中该套餐";
        [self getPhotoMode];
    }else{
        str = @"下单";
    }
    
    UIButton * sureBtn = [UIButton initButton:CGRectMake(45,4.5, 230, 40) btnImage:LOADIMAGE(@"xiadan@2x") btnTitle:str titleColor:[UIColor whiteColor] titleFont:[UIFont systemFontOfSize:16]];
    [sureBtn addTarget:self action:@selector(sureBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [footview addSubview:sureBtn];
}

-(void)initHeadViews
{
    UIView * headView = [UIView initViewRect:CGRectMake(0, 0,UI_SCREEN_WIDTH, 480/2.0f) andBackGroudColor:self.contentView.backgroundColor];
    UIImageView * imageView = [UIImageView initImageViewRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, 390/2.0f) andImage:ivDetaultImg andUserInteractionEnabled:YES];
    imageView.backgroundColor = UIColorFromRGB(0xfcf2d7);
    [headView addSubview:imageView];
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showBowers)];
    [imageView addGestureRecognizer:tap];
    
    UILabel * SeriesPriceLB = [UILabel initLabelText:@"" andRect:CGRectMake(0,height_y(imageView), 114, 45) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:18] andTextColor:UIColorFromRGB(0xff786a) andTextAlignment:NSTextAlignmentRight];
    [headView addSubview:SeriesPriceLB];
    
    UILabel * MarketPriceLB = [UILabel initLabelText:@"" andRect:CGRectMake(276/2.0f,height_y(imageView), 70+20, 45) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:15] andTextColor:UIColorFromRGB(0x6f6f6f) andTextAlignment:NSTextAlignmentLeft];
    [headView addSubview:MarketPriceLB];
    
    UIView * hLine = [UIView initViewRect:CGRectMake(276/2.0f-5, height_y(imageView)+22, 80, 1) andBackGroudColor:UIColorFromRGB(0x6f6f6f)];
    [headView addSubview:hLine];
    
    UIImageView * lineiv = [UIImageView initImageViewRect:CGRectMake(479/2.0f,height_y(imageView)+5,1, 35) andImage:nil andUserInteractionEnabled:YES];
    lineiv.backgroundColor = UIColorFromRGB(0xd4ccc5);
    [headView addSubview:lineiv];
    
    UILabel * collectionLB = [UILabel initLabelText:@"" andRect:CGRectMake(479/2.0f,height_y(imageView)+21, 74, 45/2.0f) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:13.5] andTextColor:[UIColor blackColor] andTextAlignment:NSTextAlignmentCenter];
    [headView addSubview:collectionLB];
    
    UIImageView * hartIV = [UIImageView initImageViewRect:CGRectMake(535/2.0f, height_y(imageView)+7, 18, 15) andImage:nil andUserInteractionEnabled:YES];
    [headView addSubview:hartIV];
    
    UIButton * collectionBtn = [UIButton initButton:CGRectMake(514/2.0f, height_y(imageView)+5, 50, 38) btnImage:nil btnTitle:nil];
    [collectionBtn addTarget:self action:@selector(collectionClick) forControlEvents:UIControlEventTouchUpInside];
    [headView addSubview:collectionBtn];
    
    UIView * fline = [UIView initViewRect:CGRectMake(0, 240-0.5, UI_SCREEN_WIDTH, 0.5) andBackGroudColor:UIColorFromRGB(0xd4ccc5)];
    [headView addSubview:fline];
    
    imageView.tag = 1001;
    SeriesPriceLB.tag = 1002;
    MarketPriceLB.tag = 1003;
    collectionLB.tag = 1004;
    hartIV.tag = 1005;
    collectionBtn.tag = 1006;
    
    mTableView.tableHeaderView = headView;
}

-(void)initRootViews
{
    UIView * view = [UIView initViewRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, 264/2.0f) andBackGroudColor:[UIColor whiteColor]];
    
    UIView * line = [UIView initViewRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, 0.5) andBackGroudColor:UIColorFromRGB(0xd4ccc5)];
    [view addSubview:line];
    
    UILabel * lb = [UILabel initLabelText:@"套餐介绍" andRect:CGRectMake(35/2.0f, 0, 200, 74/2.0f) andBackGroudColor:mClearColor andTextFont:[UIFont systemFontOfSize:16] andTextColor:UIColorFromRGB(0x453d35) andTextAlignment:NSTextAlignmentLeft];
    [view addSubview:lb];
    
    UILabel * label = [UILabel initLabelText:@"" andRect:CGRectMake(35/2.0f, 74/2.0f-5, UI_SCREEN_WIDTH-35, 264/2.0f+5-(height_y(lb)))andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:15.5] andTextColor:UIColorFromRGB(0x453d35) andTextAlignment:NSTextAlignmentLeft];
    label.numberOfLines = 0;
    label.tag = 1212;
    [view addSubview:label];
                                                                    
    
    rootRect = view.frame;
    
    mTableView.tableFooterView = view;
}

#pragma mark
#pragma mark 显示相册
-(void)showBowers
{
    return;
    if([imageUrlArray count]){
        int count = imageUrlArray.count;
        // 1.封装图片数据
        NSMutableArray * photos = [NSMutableArray arrayWithCapacity:count];
        for (int i = 0; i<count; i++) {
            // 替换为中等尺寸图片
            NSString *url = imageUrlArray[i];
            MJPhoto * photo = [[MJPhoto alloc] init];
            photo.url = [NSURL URLWithString:url]; // 图片路径
//            photo.srcImageView = self.view.subviews[i]; // 来源于哪个UIImageView
            UIView * view = mTableView.tableHeaderView;
            photo.srcImageView = (UIImageView *)[view viewWithTag:1001];
            [photos addObject:photo];
            
        }
        
        
        // 2.显示相册
        MJPhotoBrowser * browser = [[MJPhotoBrowser alloc] init];
        browser.photos = photos; // 设置所有的图片
        [browser show];
    }
}

#pragma mark
#pragma mark 选中该套餐
-(void)sureBtnClick
{
    [XDTools sharedXDTools].SceneID = self.SceneID;
    [XDTools sharedXDTools].CustomerID = [[NSUserDefaults standardUserDefaults] valueForKey:kMY_USER_ID];
    [XDTools sharedXDTools].EmplID = self.EmplID;
    [XDTools sharedXDTools].SeriesID = self.SeriesID;
    [XDTools sharedXDTools].CityID = BJcityID;
//    [XDTools sharedXDTools].emplImgUrl = _emplHeadUrl;

    if(!self.type){
        [XDTools sharedXDTools].iphoneNumber = [[NSUserDefaults standardUserDefaults] valueForKey:kMY_USER_IPHONE];
        
        if(ISLOGING){
            OrderConfirmViewController * ovc = [[OrderConfirmViewController alloc] init];
            [self.navigationController pushViewController:ovc animated:YES];
            return;
        }else{
            loginViewController * loginVC = [[loginViewController alloc] init];
            loginVC.delegate = self;
            [self.navigationController pushViewController:loginVC animated:YES];
            return;
        }
    }
    
    if ([self.sceneName isEqualToString:@"出生照"]){
        APPointmentHospitalViewController * hvc = [[APPointmentHospitalViewController alloc] init];
        hvc.SceneID = self.SceneID;
        hvc.hostpitalArray = hospitalArray;
        hvc.type = 1;
        hvc.empID = self.EmplID;
        hvc.SeriesID = self.SeriesID;
        [self.navigationController pushViewController:hvc animated:YES];
    }else{
        AppointmentPhotographerViewController * hvc = [[AppointmentPhotographerViewController alloc] init];
        hvc.SceneID = self.SceneID;
//        hvc.type = 1;
//        hvc.empID = self.EmplID;
//        hvc.SeriesID = self.SeriesID;
        hvc.pmid = pmid;
        hvc.pyid = pyid;
        [self.navigationController pushViewController:hvc animated:YES];
    }
}

#pragma mark
#pragma mark 收藏
-(void)collectionClick
{
    if(ISLOGING){
        [self collectTheTaoCan];
    }else{
        loginViewController * loginVC = [[loginViewController alloc] init];
        loginVC.delegate = self;
        [self.navigationController pushViewController:loginVC animated:YES];
    }
}

#pragma mark
#pragma mark UITableView Delegate
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0){
        return 5;
    }
    return 0;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 5;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0){
        return 42;
    }
    return 101;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0){
        static NSString * cellName = @"cell";
        StarCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName];
        if (cell == nil){
            cell = [[StarCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        if (!(IS_NOT_EMPTY(ReviewAvg))){
            cell.customNumberOfStars.rating =0;
            cell.starLB.hidden = YES;
        }else{
            cell.customNumberOfStars.rating = [ReviewAvg floatValue];
            cell.starLB.text = ReviewAvg;
            cell.starLB.hidden = NO;
        }
        
        if (IS_NOT_EMPTY(ReviewCount)&&(![ReviewCount isEqualToString:@"0"])){
            cell.rightLB.text = [[NSString alloc] initWithFormat:@"共%@人评价",ReviewCount];
            cell.rightLB.hidden = NO;
            cell.arrowsIV.hidden = NO;
        }else{
            cell.rightLB.hidden = YES;
            cell.arrowsIV.hidden = YES;
        }
        return cell;

    }

    static NSString * cellName = @"cell2";
    TaoCanCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName];
    if (cell == nil){
        cell = [[TaoCanCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    if (IS_NOT_EMPTY(ModeCount)){
        cell.countLB1.text =  [NSString stringWithFormat:@"%@组",ModeCount];
    }
    if (IS_NOT_EMPTY(ShootCount)){
        cell.countLB2.text =  [NSString stringWithFormat:@"%@张",ShootCount];
    }
    if (IS_NOT_EMPTY(RepairCount)){
        cell.countLB3.text =  [NSString stringWithFormat:@"%@张",RepairCount];
    }
    if (IS_NOT_EMPTY(PhotoCount)){
        if([PhotoCount isEqualToString:@"all"]){
            cell.countLB4.text = @"全送";
        }else{
            cell.countLB4.text = [NSString stringWithFormat:@"%@张",PhotoCount];
        }
    }

    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section ==1){
        return;
    }
    if ([ReviewCount intValue]==0){
        return;
    }
    CommentListViewController * cvc = [[CommentListViewController alloc] init];
    cvc.empleid = self.EmplID;
    cvc.seriesID = self.SeriesID;
    [self.navigationController pushViewController:cvc animated:YES];
}

#pragma mark
#pragma mark 获取套餐详情数据
-(void)getTaoCanDetailDatas
{
    if (!(IS_NOT_EMPTY(self.SeriesID)&&IS_NOT_EMPTY(self.EmplID)&&IS_NOT_EMPTY(self.SceneID))){
        return;
    }
    
    if (![XDTools NetworkReachable]){
        [XDTools showTips:brokenNetwork toView:self.view];
        return;
    }
    
    //SeriesID 套餐ID EmplID 摄影师ID  SceneID 场景ID
    NSDictionary * parms;
    if (ISLOGING){
        parms = @{@"SeriesID":self.SeriesID,
                  @"EmplID":self.EmplID,
                  @"SceneID":self.SceneID,
                  @"CustomerID":[[NSUserDefaults standardUserDefaults] valueForKey:kMY_USER_ID]};
    }else{
        parms = @{@"SeriesID":self.SeriesID,
                  @"EmplID":self.EmplID,
                  @"SceneID":self.SceneID};
    }

    ASIHTTPRequest * request = [XDTools postRequestWithDict:parms API:taocan_detail];
    __weak ASIHTTPRequest * mrequest = request;
    [request setCompletionBlock:^{
        [XDTools hideProgress:self.contentView];
        NSDictionary * tmpDict = [XDTools JSonFromString:[mrequest responseString]];
        if ([tmpDict[@"status"] intValue]==1){
            NSDictionary * dict = tmpDict[@"data"];
            if(!dict.allKeys){
                [XDTools showTips:tmpDict[@"msg"] toView:self.view];
                mTableView.hidden = YES;
                footview.hidden = YES;
                return;
            }
            [imageUrlArray removeAllObjects];
            [imageUrlArray addObjectsFromArray:dict[@"PhotoList"]];
            UIView * headview = mTableView.tableHeaderView;
            for (UIView * view in headview.subviews){
                if ([view isKindOfClass:[UIImageView class]]){
                    if(view.tag == 1001){   //图片
                        [(UIImageView *)view sd_setImageWithURL:[NSURL URLWithString:dict[@"Photo"]] placeholderImage:ivDetaultImg];
                    }else if (view.tag == 1005){    //是否收藏
                        if([tmpDict[@"data"][@"IsCollection"] intValue]==0){
                            ((UIImageView *)view).image = LOADIMAGE(@"nocollection@2x");
                        }else{
                            ((UIImageView *)view).image = LOADIMAGE(@"iscollection@2x");
                        }
                        isCollection = [tmpDict[@"data"][@"IsCollection"] boolValue];
                    }
                }else{
                    if ([view isKindOfClass:[UILabel class]]){
                        if (view.tag == 1002){  //app价
                            ((UILabel *)view).text = [NSString stringWithFormat:@"%@元",dict[@"SeriesPrice"]];
                        }else if (view.tag == 1003){    //市场价
                            ((UILabel *)view).text = [NSString stringWithFormat:@"%@元",dict[@"MarketPrice"]];
                        }else if (view.tag == 1004){    //收藏或已收藏
                            if([dict[@"IsCollection"] intValue]==0){
                                ((UILabel *)view).text = @"收藏";
                            }else{
                                ((UILabel *)view).text = @"已收藏";
                            }
                        }
                    }
                }
            }
            
            UIView * rootview = (UIView * )mTableView.tableFooterView;
            for (UIView * view in rootview.subviews){
                if ([view isKindOfClass:[UILabel class]]){
                    if (view.tag==1212){
                        ((UILabel *)view).text = tmpDict[@"data"][@"SeriesDesc"];
                        [view sizeToFit];
                        CGFloat cheight = view.frame.size.height-(264/2.0f+5-74/2.0f);
                        rootRect.size.height +=cheight+10;
                        rootview.frame =rootRect;
                        mTableView.tableFooterView = rootview;
                        break;
                    }
                }
            }
            ReviewAvg = tmpDict[@"data"][@"ReviewAvg"];
            ReviewCount = tmpDict[@"data"][@"ReviewCount"];
            
            ModeCount = tmpDict[@"data"][@"ModeCount"];
            ShootCount = tmpDict[@"data"][@"ShootCount"];
            RepairCount = tmpDict[@"data"][@"RepairCount"];
            PhotoCount = tmpDict[@"data"][@"PhotoCount"];
            
            [mTableView reloadData];
            
            //存储 -- 套餐详情
            [XDTools sharedXDTools].taocanImgUrl = [tmpDict[@"data"][@"PhotoList"] firstObject];
            [XDTools sharedXDTools].taocanName = tmpDict[@"data"][@"SeriesName"];
            [XDTools sharedXDTools].taocanDesc = tmpDict[@"data"][@"SeriesDesc"];
            [XDTools sharedXDTools].taocanPrcie = tmpDict[@"data"][@"SeriesPrice"];
            
        }else{
            [XDTools showTips:tmpDict[@"msg"] toView:self.view];
        }
    }];
    [request setFailedBlock:^{
        [XDTools hideProgress:self.contentView];
        [XDTools showTips:networkovertime toView:self.view];
    }];
    [request startAsynchronous];
    [XDTools showProgress:self.contentView];
}

#pragma mark
#pragma mark 提交收藏
-(void)collectTheTaoCan
{
    if (![XDTools NetworkReachable]){
        [XDTools showTips:networkovertime toView:self.view];
        return;
    }
    NSString * api;
    NSDictionary * parms = @{@"CustomerID":[[NSUserDefaults standardUserDefaults] valueForKey:kMY_USER_ID],
                           @"EmplID":self.EmplID,
                           @"SeriesID":self.SeriesID,
                           @"SceneID":self.SceneID,
                           @"Type":@"S"};;
    if (!isCollection){
        api = API_COLLECT;
    }else{
        api = API_cancellation;
    }
    
    ASIHTTPRequest * request = [XDTools postRequestWithDict:parms API:api];
    __weak ASIHTTPRequest * mrequest = request;
    [request setCompletionBlock:^{
        NSDictionary * tmpDict = [XDTools JSonFromString:[mrequest responseString]];
        if([[tmpDict objectForKey:@"status"] intValue] == 1){
            [XDTools showTips:[tmpDict valueForKey:@"msg"] toView:self.view];
            UIView * headview = mTableView.tableHeaderView;
            for (UIView * view in headview.subviews){
                if ([view isKindOfClass:[UIImageView class]]){
                    if (view.tag == 1005){
                        if (isCollection){
                            ((UIImageView *)view).image = LOADIMAGE(@"nocollection@2x");
                            isCollection = NO;
                        }else{
                            ((UIImageView *)view).image = LOADIMAGE(@"iscollection@2x");
                            isCollection = YES;
                        }
                    }
                }
            }
        }else{
            if (IS_NOT_EMPTY([tmpDict valueForKey:@"msg"])){
                [XDTools showTips:[tmpDict valueForKey:@"msg"] toView:self.view];
            }
        }
    }];
    [request setFailedBlock:^{
        [XDTools showTips:networkovertime toView:self.view];
    }];
    [request startAsynchronous];
    
}

#pragma mark
#pragma mark 获取拍摄方式
-(void)getPhotoMode
{
    if (!(IS_NOT_EMPTY(self.SceneID))){
        return;
    }
    
    if (![XDTools NetworkReachable]){
        [XDTools showTips:brokenNetwork toView:self.view];
        return;
    }
    
    //SceneID 场景ID
    NSDictionary * parms = @{@"SceneID":self.SceneID};
    
    ASIHTTPRequest * request = [XDTools postRequestWithDict:parms API:API_getPhotoMode];
    __weak ASIHTTPRequest * mrequest = request;
    [request setCompletionBlock:^{
        NSDictionary * tmpDict = [XDTools JSonFromString:[mrequest responseString]];
        if ([tmpDict[@"status"] intValue]==1){
            
            if ([self.sceneName isEqualToString:@"出生照"]){
                [hospitalArray removeAllObjects];
                [hospitalArray addObjectsFromArray:tmpDict[@"data"][@"scene"]];
            }else if ([self.sceneName isEqualToString:@"满月照"]){
                for (NSDictionary * ddct in tmpDict[@"data"][@"scene"]){
                    if ([[ddct valueForKey:@"PMName"] isEqualToString:@"上门拍摄"]){
                        pmid = [ddct valueForKey:@"PMID"];
                    }else if ([[ddct valueForKey:@"PMName"] isEqualToString:@"影棚拍摄"]){
                        pyid = [ddct valueForKey:@"PMID"];
                    }
                }
            }else if ([self.sceneName isEqualToString:@"百天照"]){
                for (NSDictionary * ddct in tmpDict[@"data"][@"scene"]){
                    if ([[ddct valueForKey:@"PMName"] isEqualToString:@"上门拍摄"]){
                        pmid = [ddct valueForKey:@"PMID"];
                    }else if ([[ddct valueForKey:@"PMName"] isEqualToString:@"影棚拍摄"]){
                        pyid = [ddct valueForKey:@"PMID"];
                    }
                }
            }else if ([self.sceneName isEqualToString:@"周岁照"]){
                for (NSDictionary * ddct in tmpDict[@"data"][@"scene"]){
                    if ([[ddct valueForKey:@"PMName"] isEqualToString:@"上门拍摄"]){
                        pmid = [ddct valueForKey:@"PMID"];
                    }else if ([[ddct valueForKey:@"PMName"] isEqualToString:@"影棚拍摄"]){
                        pyid = [ddct valueForKey:@"PMID"];
                    }
                }
            }
            
        }else{
            [XDTools showTips:tmpDict[@"msg"] toView:self.view];
        }
    }];
    [request setFailedBlock:^{
        [XDTools hideProgress:self.view];
        [XDTools showTips:networkovertime toView:self.view];
    }];
    [request startAsynchronous];
}

-(void)lReflashData
{
    [self getTaoCanDetailDatas];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
